package com.test.learnkotlin



abstract class Car {
    private var mPrice: String? = null

    fun setPrice(price: String?) {
        mPrice = price
    }

    fun getPrice(): String {
        return mPrice ?: "0.00"
    }

}

class M9SUVCar : Car() {
}

class U8SUVCar : Car() {
}

fun main() {
    val m9Car = M9SUVCar()
    m9Car.setPrice("46.80")

    val u8SUVCar = U8SUVCar()
    u8SUVCar.setPrice("109.80")

    println("M9SUVCar的价格：${m9Car.getPrice()} 万元")
    println("U8SUVCar的价格：${u8SUVCar.getPrice()} 万元")
}

